package com.sinoglobal.ningxia.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.sinoglobal.ningxia.R;
import com.sinoglobal.ningxia.beans.Type;
/**
 * 
 * @author zbl
 * @createdate 2014-6-23 下午5:39:32
 * @Description:活动筛选的adapter
 */
public class EnentsListViewAdapter extends BaseAdapter implements ListAdapter {
	private Context context;
	private ArrayList<Type> typelist=new ArrayList<Type>();//删选的范围，如：全部、优惠、活动
	public EnentsListViewAdapter(Context context) {

    this.context=context;
    
	}
	
	
	public void addData( ArrayList<Type> typelist){
		 this.typelist=typelist;
	}
	public ArrayList<Type> getTypelist() {
		return typelist;
	}



	public void setTypelist(ArrayList<Type> typelist) {
		this.typelist = typelist;
	}



	@Override
	public int getCount() {
		return typelist.size();
	}

	@Override
	public Object getItem(int position) {
		return typelist.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = LayoutInflater.from(context).inflate(R.layout.activitieslistiew_item, null);
		TextView tv = (TextView) view.findViewById(R.id.act_listview_item);	
		tv.setText(typelist.get(position).getType_name());
		return view;
	}

}
